package test.cor.command;

import java.net.UnknownHostException;

import functionality.Network;

public class ReadScaleCommand implements ICommand{
	
	ICommand nextCommand;
	
	@Override
	public void command(String cmd) {
		if (cmd.equals("read")) {
			System.out.println("TESTREAD");
			try {
				Network.getInstance().sendToServer("S");
				System.out.println(Network.getInstance().readFromServer());
			} catch (UnknownHostException e) {
				e.printStackTrace();
			}
		}
		
		if (nextCommand != null) {
			nextCommand.command(cmd);
		}
	}

	@Override
	public String info() {
		return "read - Read scale";
	}

	@Override
	public void setNextChain(ICommand nextChain) {
		this.nextCommand = nextChain;
		
	}

}
